package com.xb.system.config;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Value;
import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

import java.nio.charset.StandardCharsets;

/**
 * @author lzy
 * @create 2024/10/22 17:36
 */
@Component
public class BusinessEmailBloomFilterConfig {

    @Value("${bloom.businessEmail.expectedInsertions:170000000}")
    private long expectedInsertions;

    @Value("${bloom.businessEmail.falseProbability:0.01}")
    private double falseProbability;

    public BloomFilter<String> createBloomFilter() {
        return BloomFilter.create(Funnels.stringFunnel(StandardCharsets.UTF_8), expectedInsertions, falseProbability);
    }





}
